package top.fyr.controller;

import com.github.pagehelper.PageInfo;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.fyr.model.User;
import top.fyr.service.UserService;

import java.util.List;

/**
 * @Description
 * @Author 付阳荣
 * @CreateDate 2018/2/26
 */
@RestController
public class UserController {

    @Autowired
    private UserService userService;


    @RequestMapping("/listAllUsers")
    public PageInfo listAllUsers(int pageNum, int pageSize) {
        List<User> list = userService.listUsers(new RowBounds(pageNum, pageSize));
        //用PageInfo对结果进行包装
        PageInfo page = new PageInfo(list);
        return page;
    }


}
